package com.gpy.hospital.cms.controller;

import com.gpy.hospital.cms.service.IXuanZuoService;
import com.gpy.hospital.cms.vo.XuanZuoVo;
import com.gpy.hospital.common.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author
 * @Date 2020/3/27 9:49
 * @Desc
 **/
@Controller
public class XuanZuoController {
    @Autowired
    private IXuanZuoService xuanZuoService;


    @GetMapping("/xuan/zuo")
    public String xuanZuo(Model model) {
        List<XuanZuoVo> xuanZuoVoList = xuanZuoService.getAll();
        model.addAttribute("xuanZuoVoList", xuanZuoVoList);
        return "/reception/xuanzuo";
    }


    @PostMapping("/comfirm/zuo")
    @ResponseBody
    public ServerResponse confirmZUo(@RequestParam("id") Integer id, HttpServletRequest request) {
        return xuanZuoService.confirmZuo(id, request);
    }

}
